<template>
	<view class="pd24_15">
		<view class="order-time-line">
			<view class="order-time-main">
				<view v-for="(item,index) in datasa" :key="index" class="pb24">
					<order-integralgoods :datas="item"></order-integralgoods>
				</view>
				<uni-pagination @change="onPageChange" 
				v-if="total>pageSize" 
				show-icon="true" 
				:pageSize="pageSize" 
				:total="total" 
				current="1">
				</uni-pagination>
			</view>
		</view>
	</view>
</template>

<script>
	import uniPagination from '@/components/uni-pagination/uni-pagination.vue'
	export default{
		components: {
			uniPagination
		},
		data(){
			return {
				datasa:[],
				total:0,
				pageSize:10,
			}
		},
		onLoad(){
			this.getList(0)
		},
		onShow() {
			uni.setNavigationBarTitle({
			    title: this.$t('usermenu.buyvideo')
			});
		},
		methods:{
			onPageChange(e) {
			    this.getList(e.current-1)
				uni.pageScrollTo({
				    scrollTop: 0,
				    duration: 100
				});
			},
			async getList(offset) {
				let data = {};
				data.limit=this.pageSize
				data.offset=this.pageSize*offset
				if(uni.getStorageSync("userinfo").token){
					data.token = uni.getStorageSync("userinfo").token
					data.uid = uni.getStorageSync("userinfo").id
				}
				let [err,res] =await this.$httpas.get('/api/video/orderlists',data);
				if(res.data.rows){
					this.total = res.data.total
					this.datasa = res.data.rows
				}
			},
		}
	}
</script>

<style>
	.order-time-line{
		padding-left: 0rpx;
	}
	.order-time-main{
		width: 100%;
		min-height: 100vh;
	}
	.order-list-item-tit{
		position: relative;
		height: 60rpx;
		line-height: 60rpx;
	}
	.order-list-item-tit .order-type{
		width: 60rpx;
		height: 60rpx;
		position: absolute;
		left: -90rpx;
		top: 0;
	}
	.order-list-item-l{
		width: 200rpx;
		height: 150rpx;
		border-radius: 8rpx;
		background: #F2F2F2;
	}
	.order-list-item-r{
		width: calc(100% - 200rpx);
		padding-left: 30rpx;
	}
	.pb24 {
	    padding-bottom: 40upx;
	}
</style>